1. Field of Description
The present description relates, in general, to compilers and compilation methods, and, more particularly, to a compiler and compilation method that provides provide automated correction of errors detected or occurring during compilation of an input file in a source language to a compiled output file in a target language, e.g., to provide output in the form of executable code or binary (in many cases, errors are corrected by the compiler or compilation method without user intervention/action).
2. Relevant Background
In general form, a compiler is a program that is run on a computer that accepts as input a program text in a certain language and produces as output a program text in another language. For example, the input or source language may be C++, Java, or some other programming language while the target language may be machine code (or executable code) for a particular manufacturer's processor series. The part of a compiler that performs the analysis of the source language text is called the front-end and the part that does the target language synthesis is the back-end. Modern compilers often include a compiler driver that invokes and coordinates processing by the front-end and back-end components such as lexical and syntax analysis components or parsers, context handlers such as linkers, and other components or modules.
Currently, when users of a compiler try to compile an application they have written, the compilation process will simply stop when an error occurs or is detected by one or more of the components/modules invoked by the compiler driver. Specifically, the compiler may stop the compilation process when a syntax error is detected by a syntax parser, when a linker error is found by a linker, and when other errors are detected. When the compilation process is stopped, the compiler (or compiler driver) may generate a message for display to a programmer/user (or for print out) to notify programmers/users of the compiler that some errors stopped the compilation. The compiler may include a module or tool to provide some level of syntax error detection that may be reported in the error messages or in a report provided to the programmer, and some compilers may flag syntax errors in the source edit window as users are editing their codes.
After compilation has stopped and an error report has been generated by the compiler, the programmers/users have to examine the error messages to try to identify a problem in their source file. Once a problem is tentatively identified by examining the compiler error report, the programmer may attempt to fix the problem(s) by modifying the source file and restarting the compilation process with the modified source file. This iterative process is repeated until the compilation is successful or no viable solution is found or available to achieve successful compilation. As any programmer will attest, the compilation and program debugging process may be very lengthy or time consuming and often frustrating as even minor errors can cause compilation to crash or halt in midstream.